﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;

namespace Clannan.Helper
{
    public class SendEmail
    {
        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="emailAddress">邮件地址</param>
        /// <param name="emailTitle">邮件标题</param>
        /// <param name="emailContent">邮件内容</param>
        public void Send(string emailAddress, string emailTitle, string emailContent)
        {
            if (!string.IsNullOrEmpty(emailAddress))
            {
                SmtpClient client = new SmtpClient("smtp.yeah.net");
                client.UseDefaultCredentials = false;
                client.Credentials = new System.Net.NetworkCredential("Clannan@yeah.net", "15813350363");
                client.DeliveryMethod = SmtpDeliveryMethod.Network;

                MailMessage message = new System.Net.Mail.MailMessage();
                message.From = new MailAddress("Clannan@yeah.net");    //发件人的Email地址
                message.To.Add(emailAddress);  //收件人的Email地址
                message.Subject = emailTitle;  //邮件的标题
                message.Body = emailContent;
                message.BodyEncoding = System.Text.Encoding.UTF8;
                message.IsBodyHtml = true;

                client.Send(message);
            }
        }
    }
}